.class public Lrexsee/natives/RexseeJavaBar;
.super Ljava/lang/Object;
.source "RexseeJavaBar.java"

# interfaces
.implements Lrexsee/core/browser/clazz/JavascriptInterface;


# static fields
.field public static final ERROR_BAR_NOT_EXISTS:Ljava/lang/String; = "The bar specified by the id does not exist."

.field private static final INTERFACE_NAME:Ljava/lang/String; = "JavaBar"


# instance fields
.field private final mBrowser:Lrexsee/core/browser/Browser;

.field private final mContext:Landroid/content/Context;

.field private final mLayout:Lrexsee/core/browser/clazz/RootViewInterface;

.field private final mMap:Ljava/util/HashMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/String;",
            "Lrexsee/natives/widget/JavaBar;",
            ">;"
        }
    .end annotation
.end field

.field private final mViews:Lrexsee/natives/RexseeJavaView;

.field private syncTag:Z


# direct methods
.method public constructor <init>(Lrexsee/core/browser/clazz/RootViewInterface;Lrexsee/natives/RexseeJavaView;)V
    .locals 1
    .param p1, "rootView"    # Lrexsee/core/browser/clazz/RootViewInterface;
    .param p2, "views"    # Lrexsee/natives/RexseeJavaView;

    .prologue
    .line 42
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 38
    const/4 v0, 0x0

    iput-boolean v0, p0, Lrexsee/natives/RexseeJavaBar;->syncTag:Z

    .line 43
    iput-object p1, p0, Lrexsee/natives/RexseeJavaBar;->mLayout:Lrexsee/core/browser/clazz/RootViewInterface;

    .line 44
    invoke-interface {p1}, Lrexsee/core/browser/clazz/RootViewInterface;->getBrowser()Lrexsee/core/browser/Browser;

    move-result-object v0

    iput-object v0, p0, Lrexsee/natives/RexseeJavaBar;->mBrowser:Lrexsee/core/browser/Browser;

    .line 45
    iget-object v0, p0, Lrexsee/natives/RexseeJavaBar;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {v0}, Lrexsee/core/browser/Browser;->getContext()Landroid/content/Context;

    move-result-object v0

    iput-object v0, p0, Lrexsee/natives/RexseeJavaBar;->mContext:Landroid/content/Context;

    .line 46
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    iput-object v0, p0, Lrexsee/natives/RexseeJavaBar;->mMap:Ljava/util/HashMap;

    .line 47
    iput-object p2, p0, Lrexsee/natives/RexseeJavaBar;->mViews:Lrexsee/natives/RexseeJavaView;

    .line 49
    return-void
.end method

.method static synthetic access$0(Lrexsee/natives/RexseeJavaBar;)Lrexsee/core/browser/clazz/RootViewInterface;
    .locals 1

    .prologue
    .line 33
    iget-object v0, p0, Lrexsee/natives/RexseeJavaBar;->mLayout:Lrexsee/core/browser/clazz/RootViewInterface;

    return-object v0
.end method

.method static synthetic access$1(Lrexsee/natives/RexseeJavaBar;)Lrexsee/core/browser/Browser;
    .locals 1

    .prologue
    .line 34
    iget-object v0, p0, Lrexsee/natives/RexseeJavaBar;->mBrowser:Lrexsee/core/browser/Browser;

    return-object v0
.end method

.method static synthetic access$2(Lrexsee/natives/RexseeJavaBar;Z)V
    .locals 0

    .prologue
    .line 38
    iput-boolean p1, p0, Lrexsee/natives/RexseeJavaBar;->syncTag:Z

    return-void
.end method

.method static synthetic access$3(Lrexsee/natives/RexseeJavaBar;)Ljava/util/HashMap;
    .locals 1

    .prologue
    .line 36
    iget-object v0, p0, Lrexsee/natives/RexseeJavaBar;->mMap:Ljava/util/HashMap;

    return-object v0
.end method

.method private remove_(Ljava/lang/String;)V
    .locals 3
    .param p1, "id"    # Ljava/lang/String;

    .prologue
    .line 52
    iget-object v1, p0, Lrexsee/natives/RexseeJavaBar;->mMap:Ljava/util/HashMap;

    invoke-virtual {v1, p1}, Ljava/util/HashMap;->containsKey(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_1

    .line 76
    :cond_0
    return-void

    .line 53
    :cond_1
    iget-object v1, p0, Lrexsee/natives/RexseeJavaBar;->mMap:Ljava/util/HashMap;

    invoke-virtual {v1, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lrexsee/natives/widget/JavaBar;

    .line 54
    .local v0, "bar":Lrexsee/natives/widget/JavaBar;
    if-eqz v0, :cond_0

    .line 55
    const/4 v1, 0x0

    iput-boolean v1, p0, Lrexsee/natives/RexseeJavaBar;->syncTag:Z

    .line 56
    iget-object v1, p0, Lrexsee/natives/RexseeJavaBar;->mContext:Landroid/content/Context;

    check-cast v1, Landroid/app/Activity;

    new-instance v2, Lrexsee/natives/RexseeJavaBar$1;

    invoke-direct {v2, p0, v0}, Lrexsee/natives/RexseeJavaBar$1;-><init>(Lrexsee/natives/RexseeJavaBar;Lrexsee/natives/widget/JavaBar;)V

    invoke-virtual {v1, v2}, Landroid/app/Activity;->runOnUiThread(Ljava/lang/Runnable;)V

    .line 68
    :goto_0
    iget-boolean v1, p0, Lrexsee/natives/RexseeJavaBar;->syncTag:Z

    if-nez v1, :cond_0

    .line 70
    const-wide/16 v1, 0x64

    :try_start_0
    invoke-static {v1, v2}, Ljava/lang/Thread;->sleep(J)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 71
    :catch_0
    move-exception v1

    goto :goto_0
.end method


# virtual methods
.method public add(Ljava/lang/String;Ljava/lang/String;)V
    .locals 4
    .param p1, "id"    # Ljava/lang/String;
    .param p2, "style"    # Ljava/lang/String;

    .prologue
    .line 83
    if-eqz p1, :cond_0

    invoke-virtual {p1}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v1

    const-string v2, ""

    invoke-virtual {v1, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v1

    if-eqz v1, :cond_2

    .line 84
    :cond_0
    iget-object v1, p0, Lrexsee/natives/RexseeJavaBar;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/natives/RexseeJavaBar;->getInterfaceName()Ljava/lang/String;

    move-result-object v2

    const-string v3, "The id of bar should not be null."

    invoke-virtual {v1, v2, v3}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    .line 117
    :cond_1
    :goto_0
    return-void

    .line 87
    :cond_2
    iget-object v1, p0, Lrexsee/natives/RexseeJavaBar;->mMap:Ljava/util/HashMap;

    invoke-virtual {v1, p1}, Ljava/util/HashMap;->containsKey(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_3

    .line 88
    iget-object v1, p0, Lrexsee/natives/RexseeJavaBar;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/natives/RexseeJavaBar;->getInterfaceName()Ljava/lang/String;

    move-result-object v2

    const-string v3, "The specified view has already been shown."

    invoke-virtual {v1, v2, v3}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0

    .line 91
    :cond_3
    iget-object v1, p0, Lrexsee/natives/RexseeJavaBar;->mViews:Lrexsee/natives/RexseeJavaView;

    invoke-virtual {v1, p1}, Lrexsee/natives/RexseeJavaView;->getViewTag(Ljava/lang/String;)Lrexsee/natives/ViewTag;

    move-result-object v0

    .line 92
    .local v0, "viewTag":Lrexsee/natives/ViewTag;
    if-nez v0, :cond_4

    .line 93
    iget-object v1, p0, Lrexsee/natives/RexseeJavaBar;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/natives/RexseeJavaBar;->getInterfaceName()Ljava/lang/String;

    move-result-object v2

    const-string v3, "The specified view is null."

    invoke-virtual {v1, v2, v3}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0

    .line 96
    :cond_4
    const/4 v1, 0x0

    iput-boolean v1, p0, Lrexsee/natives/RexseeJavaBar;->syncTag:Z

    .line 97
    iget-object v1, p0, Lrexsee/natives/RexseeJavaBar;->mContext:Landroid/content/Context;

    check-cast v1, Landroid/app/Activity;

    new-instance v2, Lrexsee/natives/RexseeJavaBar$2;

    invoke-direct {v2, p0, p2, v0, p1}, Lrexsee/natives/RexseeJavaBar$2;-><init>(Lrexsee/natives/RexseeJavaBar;Ljava/lang/String;Lrexsee/natives/ViewTag;Ljava/lang/String;)V

    invoke-virtual {v1, v2}, Landroid/app/Activity;->runOnUiThread(Ljava/lang/Runnable;)V

    .line 110
    :goto_1
    iget-boolean v1, p0, Lrexsee/natives/RexseeJavaBar;->syncTag:Z

    if-nez v1, :cond_1

    .line 112
    const-wide/16 v1, 0x64

    :try_start_0
    invoke-static {v1, v2}, Ljava/lang/Thread;->sleep(J)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_1

    .line 113
    :catch_0
    move-exception v1

    goto :goto_1
.end method

.method public exists(Ljava/lang/String;)Z
    .locals 1
    .param p1, "id"    # Ljava/lang/String;

    .prologue
    .line 161
    iget-object v0, p0, Lrexsee/natives/RexseeJavaBar;->mMap:Ljava/util/HashMap;

    invoke-virtual {v0, p1}, Ljava/util/HashMap;->containsKey(Ljava/lang/Object;)Z

    move-result v0

    return v0
.end method

.method public getIds()Ljava/lang/String;
    .locals 6

    .prologue
    const-string v5, "\""

    .line 167
    const-string v2, ""

    .line 168
    .local v2, "rtn":Ljava/lang/String;
    iget-object v3, p0, Lrexsee/natives/RexseeJavaBar;->mMap:Ljava/util/HashMap;

    invoke-virtual {v3}, Ljava/util/HashMap;->keySet()Ljava/util/Set;

    move-result-object v0

    .line 169
    .local v0, "ids":Ljava/util/Set;, "Ljava/util/Set<Ljava/lang/String;>;"
    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v1

    .line 170
    .end local p0    # "this":Lrexsee/natives/RexseeJavaBar;
    .local v1, "iterator":Ljava/util/Iterator;, "Ljava/util/Iterator<Ljava/lang/String;>;"
    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-nez v3, :cond_0

    .line 174
    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "["

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v3, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, "]"

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    return-object v3

    .line 171
    :cond_0
    const-string v3, ""

    invoke-virtual {v2, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-nez v3, :cond_1

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-static {v2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v4, ","

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    .line 172
    :cond_1
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-static {v2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v4

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v4, "\""

    invoke-virtual {v3, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Ljava/lang/String;

    invoke-virtual {v3, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, "\""

    invoke-virtual {v3, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    goto :goto_0
.end method

.method public getInheritInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 0
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 24
    return-object p0
.end method

.method public getInterfaceName()Ljava/lang/String;
    .locals 2

    .prologue
    .line 20
    new-instance v0, Ljava/lang/StringBuilder;

    iget-object v1, p0, Lrexsee/natives/RexseeJavaBar;->mBrowser:Lrexsee/core/browser/Browser;

    iget-object v1, v1, Lrexsee/core/browser/Browser;->application:Lrexsee/core/application/RexseeApplication;

    iget-object v1, v1, Lrexsee/core/application/RexseeApplication;->resources:Lrexsee/core/application/Resource;

    iget-object v1, v1, Lrexsee/core/application/Resource;->prefix:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v1, "JavaBar"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getNewInterface(Lrexsee/core/browser/Browser;)Lrexsee/core/browser/clazz/JavascriptInterface;
    .locals 0
    .param p1, "childBrowser"    # Lrexsee/core/browser/Browser;

    .prologue
    .line 28
    return-object p0
.end method

.method public getStyle(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    .locals 1
    .param p1, "id"    # Ljava/lang/String;
    .param p2, "name"    # Ljava/lang/String;

    .prologue
    .line 158
    iget-object v0, p0, Lrexsee/natives/RexseeJavaBar;->mMap:Ljava/util/HashMap;

    invoke-virtual {v0, p1}, Ljava/util/HashMap;->containsKey(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_0

    const-string v0, ""

    .end local p0    # "this":Lrexsee/natives/RexseeJavaBar;
    :goto_0
    return-object v0

    .restart local p0    # "this":Lrexsee/natives/RexseeJavaBar;
    :cond_0
    iget-object v0, p0, Lrexsee/natives/RexseeJavaBar;->mMap:Ljava/util/HashMap;

    invoke-virtual {v0, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object p0

    .end local p0    # "this":Lrexsee/natives/RexseeJavaBar;
    check-cast p0, Lrexsee/natives/widget/JavaBar;

    invoke-virtual {p0, p2}, Lrexsee/natives/widget/JavaBar;->getStyle(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    goto :goto_0
.end method

.method public remove(Ljava/lang/String;)V
    .locals 1
    .param p1, "id"    # Ljava/lang/String;

    .prologue
    .line 120
    iget-object v0, p0, Lrexsee/natives/RexseeJavaBar;->mMap:Ljava/util/HashMap;

    invoke-virtual {v0, p1}, Ljava/util/HashMap;->containsKey(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_0

    .line 123
    :goto_0
    return-void

    .line 121
    :cond_0
    invoke-direct {p0, p1}, Lrexsee/natives/RexseeJavaBar;->remove_(Ljava/lang/String;)V

    .line 122
    iget-object v0, p0, Lrexsee/natives/RexseeJavaBar;->mMap:Ljava/util/HashMap;

    invoke-virtual {v0, p1}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    goto :goto_0
.end method

.method public removeAll()V
    .locals 3

    .prologue
    .line 125
    iget-object v2, p0, Lrexsee/natives/RexseeJavaBar;->mMap:Ljava/util/HashMap;

    invoke-virtual {v2}, Ljava/util/HashMap;->keySet()Ljava/util/Set;

    move-result-object v1

    .line 126
    .local v1, "keys":Ljava/util/Set;, "Ljava/util/Set<Ljava/lang/String;>;"
    invoke-interface {v1}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v0

    .line 127
    .local v0, "iterator":Ljava/util/Iterator;, "Ljava/util/Iterator<Ljava/lang/String;>;"
    :goto_0
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-nez v2, :cond_0

    .line 130
    iget-object v2, p0, Lrexsee/natives/RexseeJavaBar;->mMap:Ljava/util/HashMap;

    invoke-virtual {v2}, Ljava/util/HashMap;->clear()V

    .line 131
    return-void

    .line 128
    :cond_0
    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ljava/lang/String;

    invoke-direct {p0, v2}, Lrexsee/natives/RexseeJavaBar;->remove_(Ljava/lang/String;)V

    goto :goto_0
.end method

.method public setStyle(Ljava/lang/String;Ljava/lang/String;)V
    .locals 3
    .param p1, "id"    # Ljava/lang/String;
    .param p2, "style"    # Ljava/lang/String;

    .prologue
    .line 133
    if-eqz p1, :cond_0

    invoke-virtual {p1}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v0

    const-string v1, ""

    invoke-virtual {v0, v1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_0

    iget-object v0, p0, Lrexsee/natives/RexseeJavaBar;->mMap:Ljava/util/HashMap;

    invoke-virtual {v0, p1}, Ljava/util/HashMap;->containsKey(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_2

    .line 134
    :cond_0
    iget-object v0, p0, Lrexsee/natives/RexseeJavaBar;->mBrowser:Lrexsee/core/browser/Browser;

    invoke-virtual {p0}, Lrexsee/natives/RexseeJavaBar;->getInterfaceName()Ljava/lang/String;

    move-result-object v1

    const-string v2, "The bar specified by the id does not exist."

    invoke-virtual {v0, v1, v2}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    .line 156
    :cond_1
    return-void

    .line 137
    :cond_2
    const/4 v0, 0x0

    iput-boolean v0, p0, Lrexsee/natives/RexseeJavaBar;->syncTag:Z

    .line 138
    iget-object v0, p0, Lrexsee/natives/RexseeJavaBar;->mContext:Landroid/content/Context;

    check-cast v0, Landroid/app/Activity;

    new-instance v1, Lrexsee/natives/RexseeJavaBar$3;

    invoke-direct {v1, p0, p1, p2}, Lrexsee/natives/RexseeJavaBar$3;-><init>(Lrexsee/natives/RexseeJavaBar;Ljava/lang/String;Ljava/lang/String;)V

    invoke-virtual {v0, v1}, Landroid/app/Activity;->runOnUiThread(Ljava/lang/Runnable;)V

    .line 149
    :goto_0
    iget-boolean v0, p0, Lrexsee/natives/RexseeJavaBar;->syncTag:Z

    if-nez v0, :cond_1

    .line 151
    const-wide/16 v0, 0x64

    :try_start_0
    invoke-static {v0, v1}, Ljava/lang/Thread;->sleep(J)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 152
    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method public size()I
    .locals 1

    .prologue
    .line 164
    iget-object v0, p0, Lrexsee/natives/RexseeJavaBar;->mMap:Ljava/util/HashMap;

    invoke-virtual {v0}, Ljava/util/HashMap;->size()I

    move-result v0

    return v0
.end method
